package com.mxw.account.mapper.domain;

import com.mxw.account.enums.InvoiceStatusEnum;
import lombok.Data;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;

/** @Description @Author RingKo @Date 2022/8/22 17:01 @Version 1.0 */
@Data
@Entity
@Table(name = "account", schema = "cloud_alibaba_db")
public class AccountEntity {
  @Id
  @Column(name = "id", nullable = false)
  private int id;

  @Basic
  @Column(name = "account_code", nullable = true, length = 255)
  private String accountCode;

  @Basic
  @Column(name = "account_name", nullable = true, length = 255)
  private String accountName;

  @Basic
  @Column(name = "amount", nullable = true, precision = 2)
  private BigDecimal amount;

  @Column(name = "status", nullable = true)
  @Convert(converter = InvoiceStatusEnum.Converter.class)
  private InvoiceStatusEnum status;

  @Basic
  @Column(name = "created_at", nullable = true)
  private Timestamp createdAt;

//  /** @Description: 自定义排序规则，不匹配 > 左 > 右， 所以这里从低到高排列， 再desc排序， 得到（7、5、1、4、不匹配）的顺序 */
//  @Formula("FIELD(status,'4','1','5','7')")
//  private String customStatusSorting;
}
